
import React from "react";
import { Suspense } from 'react'
import ReactDOM from "react-dom";
import App from "./component/app";
import { Provider } from "react-redux";
import store from "./store";
import reportWebVitals from "./util/reportWebVitals";
import * as serviceWorker from "./util/serviceWorker";
import { HashRouter, Route, Switch } from 'react-router-dom'
import 'lancoo-web-ui/dist/style.css'
import 'element-theme-default';

ReactDOM.render(
  <HashRouter>
    {/* 使用了路由懒加载，所以需要使用<Suspense>包起来 */}
    <Suspense fallback={<div />}>
      <Switch>
        <Route path="/" render={routerProps => {
          return (
            <Provider store={store}>
              <App  {...routerProps}/>
            </Provider>
          )
        }} />
      </Switch>
    </Suspense>
  </HashRouter>,
  document.getElementById('root')
)

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
serviceWorker.register();
